<%@ page import="bean.User" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: liuchangling
  Date: 2021/5/30
  Time: 5:19 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
</head>
<style>
    h1 {
        text-align: center;
    }
</style>
<body style="padding:100px;">
<%
    boolean isCheckedMale=false;
    List<User> list = (List<User>) session.getAttribute("result");
    for (int i = 0; i < list.size(); i++) {
        User user = list.get(i);
        System.out.println(user.getSex());
        if (user.getSex().equals("male")) {
            isCheckedMale=true;
        } else if (user.getSex().equals("female")) {
        }
%>
<h1>编辑学员信息</h1>
<form action="update" method="post">
    <div class="form-group"><label>工号</label> </div>
    <div class="form-group">
        <input type="text" class="form-control" placeholder="工号" name="sno" value="<%=user.getSno()%>">
    </div>
    <div class="form-group"><label>姓名</label>
        <input type="text" class="form-control" placeholder="姓名" name="name" value="<%=user.getName()%>">
    </div>
    <div class="form-group">
        <label>性别</label><br>
        <label class="radio-inline"> <input type="radio" name="sex" value="male" id="male"> 男 </label>
        <label class="radio-inline"> <input type="radio" name="sex" value="female" id="female"> 女 </label>
    </div>
    <div class="form-group">
        <label>
            出生日期
        </label>
        <input type="date" class="form-control" name="birthday" value="<%=user.getBirthday()%>">
    </div>
    <div class="form-group"><label>邮箱</label>
        <input type="mail" class="form-control" placeholder="邮箱" name="mail" value="<%=user.getMail()%>">
    </div>
    <div class="form-group"><label>备注</label>
        <input type="text" class="form-control" placeholder="备注信息" name="remark" value="<%=user.getRemark()%>">
    </div>
    <%
        }
    %>
    <div class="form-group">
        <button class="btn btn-primary" type="submit">提交</button>
    </div>
</form>
</body>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
    window.onload=function () {
        if(<%=isCheckedMale==true%>) {
            $("#male").prop('checked', 'checked');
        }else {
            $("#female").prop('checked', 'checked');
        }
    }
</script>
</html>
